#pragma once

#include <string>

using std::string;
namespace mtool{

  class String:public std::string{
	public:
		 String():string(){}   				//default
        	 String(const String &str):string(str){}        // copy
        	 String(const char * str):string(str){}         //from c-string
		 String(const String& str, size_t pos, size_t len = npos):string(str,pos,len){}
        	 String(const char * str,size_t n):string(str,n){}      //from sequence 

        	 String(const string & str):string(str){}           //from std::string
        	 String operator()(int n, int m){
            		return substr(n,m);
        	 }
		
		void trim();
		void ltrim();
		void rtrim();
		const int casecompare(const char* s) ;


  };


  class StringRef{
	public:
		StringRef();
		StringRef(const char * ref);
		StringRef(const char * ref,size_t s);
		bool Equal(const char*);
		bool CaseEqual(const char*);
		std::string toString();	
		bool instr(const char * );
		const char * c_str();
		//operator=(std::string);
		bool operator<(const StringRef  & a) const;
		static bool Compare(StringRef a,StringRef b);

	protected:
		const char * pos=NULL;
		size_t size=-1;

  };

}


